package {
	import flash.events.MouseEvent;
	import flash.text.TextField;
	import flash.text.TextFormat;

	public class ScreenGameOver extends Screen2 {
		private var overFormat:TextFormat = new TextFormat();
		private var overFormat1:TextFormat = new TextFormat();
		private var over:TextField = new TextField();
		private var over2:TextField = new TextField();
		private var btnPlay:Button = new Button();
		public function ScreenGameOver() {
			setFormat();
			addLoseText();
			addButton();
			
		}
		private function setFormat():void{
			overFormat.color=0xFFFFFF;
			overFormat.size = 100;
			overFormat.align = 'center';
			overFormat.font = 'Comic sans MS';
			
			overFormat1.color=0xFFFFFF;
			overFormat1.size = 25;
			overFormat1.align = 'center';
			overFormat1.font = 'Comic sans MS';
		}
		private function addLoseText():void{
			over = new TextField();
			over.defaultTextFormat = overFormat;
			over.text = 'Perdiste!';
			over.x = 200;
			over.y = 100;
			over.width = 400;
			over.height = 300;
			addChild(over);
			
			over2 = new TextField();
			over2.defaultTextFormat = overFormat1;
			over2.text = 'Las puertas del laberinto se cerraron.';
			over2.x = 200;
			over2.y = 300;
			over2.width = 450;
			addChild(over2);
			
		}
		private function onBtnPlayClick(event:MouseEvent):void{
			laberintoapp.gotoScreen("main");
		}
		private function addButton():void{
			btnPlay = new Button();
			addChild(btnPlay);
			btnPlay.textButtom.text = 'Intenta de nuevo';
			btnPlay.x = 410;
			btnPlay.y = 400;
			btnPlay.addEventListener(MouseEvent.CLICK, onBtnPlayClick);
		}
	}
}
